package com.lhkj.ct.meta.admin.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.lhkj.ct.meta.admin.model.entity.TblMenu;
import com.lhkj.ct.meta.admin.model.vo.MenuVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2023-08-22
 */
public interface SysMenuMapper extends BaseMapper<TblMenu> {

    /**
     * 根据角色id获取路由列表
     * @return
     */
    List<TblMenu> listRoutes(@Param("userId") String userId);

    @Select("select id, parent_id, tree_path, name, type, path, component, perm, status, sort, icon, redirect, level, expand, full_path, component_name, meta, no_cache, hidden from tbl_menu ${ew.customSqlSegment}")
    List<MenuVo> listMenus(@Param(Constants.WRAPPER) Wrapper<TblMenu> wrapper);

    @Select("select id, parent_id, tree_path, name, type, path, component, perm, status, sort, icon, redirect, level, expand, full_path, component_name, meta, no_cache, hidden from tbl_menu ${ew.customSqlSegment}")
    List<TblMenu> listMenuOptions(@Param(Constants.WRAPPER) Wrapper<TblMenu> wrapper);

//    /**
//     * 根据用户id获取路由列表
//     */
//    List<TblMenu> getRoutesByUser(@Param("userId") String userId);

    /**
     * 获取用户权限集合
     *
     * @param userId
     */
    Set<String> getPermsByUserId(@Param("userId") String userId);

//    /**
//     * 获取角色权限集合
//     *
//     * @param roleIds
//     * @return
//     */
//    Set<String> getPermsByRoleIds(@Param("roleIds") Set<String> roleIds);
}
